package com.atguigu.gmall.product.rpc;

import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.model.product.to.CategoryTreeTo;
import com.atguigu.gmall.product.service.BaseCategory1Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author:lyd
 **/
@RestController
@RequestMapping("/api/inner/product")
public class CategoryTreeRpcController {

    @Autowired
    BaseCategory1Service baseCategory1Service;

    /**
     * 获取分类树，前端展示所有的分类列表
     * @return
     */
    @GetMapping("/category/tree")
    public Result<List<CategoryTreeTo>> getCategoryTreeTo() {
        List<CategoryTreeTo> list = baseCategory1Service.getCategoryTreeTo();
        return Result.ok(list);
    }
}
